package design.pattern.工厂模式;

public class MainClass {
    public static void main(String[] args) throws Exception {
        /** 加法 **/
        IFactory addFactory = new AddFactory();
        Operation add = addFactory.getInstance();
        add.setNumberA(8);
        add.setNumberB(4);
        System.out.println(add.getResult());

        /** 减法 **/
        IFactory delFactory = new DelFactory();
        Operation del = delFactory.getInstance();
        del.setNumberA(8);
        del.setNumberB(4);
        System.out.println(del.getResult());

        /** 乘法 **/
        IFactory mulFactory = new MulFactory();
        Operation mul = mulFactory.getInstance();
        mul.setNumberA(8);
        mul.setNumberB(4);
        System.out.println(mul.getResult());

        /** 除法 **/
        IFactory divFactory = new DlvFactory();
        Operation div = divFactory.getInstance();
        div.setNumberA(8);
        div.setNumberB(4);
        System.out.println(div.getResult());


    }
}
